﻿<Window x:Class="PizzaService.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:conv="clr-namespace:PizzaService.Converters"
        Title="Pizza-Service Verwaltung" Height="800" Width="1138" WindowStartupLocation="CenterScreen" Closed="Window_Closed_1" Background="#FFA41B1B">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles\Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <conv:ZutatenConverter x:Key="ZutatenConverter"/>
        </ResourceDictionary>
    </Window.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Menu Grid.Row="0" IsMainMenu="True">
            <MenuItem Header="_Pizza-Service">
                <MenuItem Header="_Login" Click="MenuItem_Click_1"/>
                <!--<MenuItem Header="_Logout" Click="MenuItem_Click_3"/>--> <!--Temporär deaktiviert-->
                <MenuItem Header="_Speise erstellen" Click="MenuItem_Click_5"/>
                <MenuItem Header="_Speise löschen" Click="MenuItem_Click"/>
                <MenuItem Header="_Beenden" Click="MenuItem_Click_2"/>
            </MenuItem>
            <MenuItem Header="_Kunde">
                <MenuItem Header="_Hinzufügen" Click="Button_Click_1"/>
                <MenuItem Header="_Löschen" Click="Button_Click_2"/>
            </MenuItem>
            <MenuItem Header="_Help" >
                <MenuItem Header="_About" Click="MenuItem_Click_4"/>
            </MenuItem>
        </Menu>
        <Grid Grid.Row="1">
            <TabControl Name="MainTabControl" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Opacity="1" Background="Transparent">
                <TabItem Header="Bestellung" FontSize="14">
                    <Grid Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="AUTO"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="AUTO"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" Margin="50,5,0,5" HorizontalAlignment="Left" Text="Kunde:" Width="55"  Style="{StaticResource CustomTextBlockStyle}"/>
                        <TextBlock Grid.Row="0" Margin="110,5,0,5" HorizontalAlignment="Left" Text="{Binding Bestellung.Kunde.Name}" TextAlignment="Left" Style="{StaticResource CustomTextBlockStyle}"/>
                        <Button Name="BtnUnChooseCustomer" Grid.Row="0" Content="Kunde abwählen" Click="BtnUnChooseCustomer_Click_1" HorizontalAlignment="Left" Margin="300,0,0,0" Width="120" Style="{StaticResource CustomButtonStyle}"/>
                        <Button Name="BtnChooseCustomer" Grid.Row="0" Content="Kunde auswählen" HorizontalAlignment="Center" Width="120" Click="BtnChooseCustomer_Click_1" Style="{StaticResource CustomButtonStyle}"/>
                        <Button Name="BtnCompleteOrder" Grid.Row="0" Content="Bestellung abschicken" Click="BtnCompleteOrder_Click_1" HorizontalAlignment="Center" Margin="400,0,0,0" Width="160" Style="{StaticResource CustomButtonStyle}"/>
                        <Button Name="BtnResetOrder" Grid.Row="0" Content="Bestellung zurücksetzen" Click="BtnResetOrder_Click_1" HorizontalAlignment="Right" Margin="0,0,50,0" Width="160" Style="{StaticResource CustomButtonStyle}"/>
                        <ListView Button.Click="RemoveFood_Click"  Grid.Row="1" Name="order" ItemsSource="{Binding Bestellung.Speisen}" Opacity="1" MouseDoubleClick="customers_MouseDoubleClick_1" FontSize="14" ItemContainerStyle="{StaticResource CustomItemContainerStlye}">
                            <ListView.Background>
                                <RadialGradientBrush>
                                    <GradientStop Color="#FFCF5454"/>
                                    <GradientStop Color="#FFA41B1B" Offset="1"/>
                                </RadialGradientBrush>
                            </ListView.Background>
                            <ListView.View>
                                <GridView ColumnHeaderContainerStyle="{StaticResource CustomHeaderStyle}">
                                    <GridViewColumn Width="80" Header="Nummer" DisplayMemberBinding="{Binding ID}"/>
                                    <GridViewColumn Width="140" Header="Name" DisplayMemberBinding="{Binding Name}"/>
                                    <GridViewColumn Width="80" Header="Typ" DisplayMemberBinding="{Binding Typ}"/>
                                    <GridViewColumn Width="80" Header="Größe" DisplayMemberBinding="{Binding Size}"/>
                                    <GridViewColumn Width="280" Header="Zutaten" DisplayMemberBinding="{Binding Zutaten, Converter={StaticResource ZutatenConverter}}"/>
                                    <GridViewColumn Width="280" Header="Extra-Zutaten" DisplayMemberBinding="{Binding ExtraZutaten, Converter={StaticResource ZutatenConverter}}"/>
                                    <GridViewColumn Width="140" Header="Preis" CellTemplate="{StaticResource RemoveFood}"/>
                                </GridView>
                            </ListView.View>
                        </ListView>
                        <TextBlock Grid.Row="2" Text="Summe:" Margin="0,5,0,5" Style="{StaticResource CustomTextBlockStyle}"/>
                        <TextBlock Grid.Row="2" Margin="0,5,-120,5" Text="{Binding Bestellung.Summe, StringFormat=C}"  Style="{StaticResource CustomTextBlockStyle}"/>
                        <TextBlock Grid.Row="2" Margin="0,5,800,5" Text="Lieferpauschale:"  Style="{StaticResource CustomTextBlockStyle}"/>
                        <TextBlock Grid.Row="2" Margin="205,5,0,5" HorizontalAlignment="Left" Text="{Binding Bestellung.Lieferpauschale, StringFormat=C}" TextAlignment="Left" Style="{StaticResource CustomTextBlockStyle}"/>
                        <TabControl Name="tabSpeisen" Grid.Row="3" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Opacity="1" Background="Transparent">
                            <TabItem Name="tabItemPizzen" Width="60" Header="Pizza" FontSize="14">
                                <Grid>
                                    <ListView Button.Click="ListViewBtnClicked"  Name="pizzaOrder" Opacity="1" FontSize="14" ItemsSource="{Binding Pizzen}" ItemContainerStyle="{StaticResource CustomItemContainerStlye}">
                                    <ListView.Background>
                                        <RadialGradientBrush>
                                            <GradientStop Color="#FFCF5454"/>
                                            <GradientStop Color="#FFA41B1B" Offset="1"/>
                                        </RadialGradientBrush>
                                    </ListView.Background>
                                    <ListView.View>
                                        <GridView ColumnHeaderContainerStyle="{StaticResource CustomHeaderStyle}">
                                        <GridViewColumn Width="70" Header="Nummer" DisplayMemberBinding="{Binding ID}"/>
                                        <GridViewColumn Width="200" Header="Name" DisplayMemberBinding="{Binding Name}"/>
                                        <GridViewColumn Width="400" Header="Zutaten" DisplayMemberBinding="{Binding Zutaten, Converter={StaticResource ZutatenConverter}}"/>
                                        <GridViewColumn Width="140" Header="Preis (klein)" CellTemplate="{StaticResource AddSmallSize}"/>
                                        <GridViewColumn Width="140" Header="Preis (groß)" CellTemplate="{StaticResource AddBigSize}"/>
                                        </GridView>
                                    </ListView.View>
                                </ListView>
                                </Grid>
                            </TabItem>
                            <TabItem Name="tabItemPasta" Width="60" Header="Pasta" FontSize="14">
                                <Grid>
                                    <ListView Button.Click="ListViewBtnClicked" Name="pastaOrder" Opacity="1" FontSize="14" ItemsSource="{Binding Pasta}" ItemContainerStyle="{StaticResource CustomItemContainerStlye}">
                                        <ListView.Background>
                                            <RadialGradientBrush>
                                                <GradientStop Color="#FFCF5454"/>
                                                <GradientStop Color="#FFA41B1B" Offset="1"/>
                                            </RadialGradientBrush>
                                        </ListView.Background>
                                        <ListView.View>
                                            <GridView ColumnHeaderContainerStyle="{StaticResource CustomHeaderStyle}">
                                                <GridViewColumn Width="70" Header="Nummer" DisplayMemberBinding="{Binding ID}"/>
                                                <GridViewColumn Width="200" Header="Name" DisplayMemberBinding="{Binding Name}"/>
                                                <GridViewColumn Width="400" Header="Zutaten" DisplayMemberBinding="{Binding Zutaten, Converter={StaticResource ZutatenConverter}}"/>
                                                <GridViewColumn Width="140" Header="Preis (klein)" CellTemplate="{StaticResource AddSmallSize}"/>
                                                <GridViewColumn Width="140" Header="Preis (groß)" CellTemplate="{StaticResource AddBigSize}"/>
                                            </GridView>
                                        </ListView.View>
                                    </ListView>
                                </Grid>
                            </TabItem>
                            <TabItem Name="tabitemSalat" Width="60" Header="Salate" FontSize="14">
                                <Grid>
                                    <ListView Button.Click="ListViewBtnClicked" Name="salatOrder" Opacity="1" FontSize="14" ItemsSource="{Binding Salate}" ItemContainerStyle="{StaticResource CustomItemContainerStlye}">
                                        <ListView.Background>
                                            <RadialGradientBrush>
                                                <GradientStop Color="#FFCF5454"/>
                                                <GradientStop Color="#FFA41B1B" Offset="1"/>
                                            </RadialGradientBrush>
                                        </ListView.Background>
                                        <ListView.View>
                                            <GridView ColumnHeaderContainerStyle="{StaticResource CustomHeaderStyle}">
                                                <GridViewColumn Width="70" Header="Nummer" DisplayMemberBinding="{Binding ID}"/>
                                                <GridViewColumn Width="200" Header="Name" DisplayMemberBinding="{Binding Name}"/>
                                                <GridViewColumn Width="400" Header="Zutaten" DisplayMemberBinding="{Binding Zutaten, Converter={StaticResource ZutatenConverter}}"/>
                                                <GridViewColumn Width="140" Header="Preis (klein)" CellTemplate="{StaticResource AddSmallSize}"/>
                                                <GridViewColumn Width="140" Header="Preis (groß)" CellTemplate="{StaticResource AddBigSize}"/>
                                            </GridView>
                                        </ListView.View>
                                    </ListView>
                                </Grid>
                            </TabItem>
                        </TabControl>
                    </Grid>
                </TabItem>
                <TabItem Header="Kundenverwaltung" FontSize="14">
                    <Grid Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="AUTO"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Button Name="BtnAssignToOrdner" Grid.Row="0" Content="Zur Bestellung zuordnen" HorizontalAlignment="Left" Margin="200,0,0,0" Width="160" Click="BtnAssignToOrdner_Click_1"  Style="{StaticResource CustomButtonStyle}"/>
                        <Button Grid.Row="0" Content="Kunde hinzufügen" HorizontalAlignment="Center" Margin="300,0,0,0" Width="120" Click="Button_Click_1" Style="{StaticResource CustomButtonStyle}"/>
                        <Button Grid.Row="0" Content="Kunde löschen" HorizontalAlignment="Center" Margin="0,0,0,0" Width="120" Click="Button_Click_2" Style="{StaticResource CustomButtonStyle}"/>
                        <ListView Grid.Row="1" Name="customers" ItemsSource="{Binding Kunden, Mode=TwoWay}" Opacity="1" MouseDoubleClick="customers_MouseDoubleClick_1" FontSize="14" ItemContainerStyle="{StaticResource CustomItemContainerStlye}">
                            <ListView.Background>
                                <RadialGradientBrush>
                                    <GradientStop Color="#FFCF5454"/>
                                    <GradientStop Color="#FFA41B1B" Offset="1"/>
                                </RadialGradientBrush>
                            </ListView.Background>
                            <ListView.View>
                                <GridView ColumnHeaderContainerStyle="{StaticResource CustomHeaderStyle}">
                                    <GridViewColumn Width="140" Header="Name" DisplayMemberBinding="{Binding Name}"/>
                                    <GridViewColumn Width="140" Header="Vorname" DisplayMemberBinding="{Binding Vorname}"/>                                   
                                    <GridViewColumn Width="140" Header="Straße" DisplayMemberBinding="{Binding Strasse}"/>
                                    <GridViewColumn Width="100" Header="Hausnummer" DisplayMemberBinding="{Binding Hausnummer}"/>
                                    <GridViewColumn Width="70" Header="PLZ" DisplayMemberBinding="{Binding PLZ}"/>
                                    <GridViewColumn Width="140" Header="Ort" DisplayMemberBinding="{Binding Ort}"/>
                                    <GridViewColumn Width="140" Header="Telefon" DisplayMemberBinding="{Binding Telefonnummer}"/>
                                    <GridViewColumn Width="200" Header="E-Mail" DisplayMemberBinding="{Binding Mail}"/>
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </Grid>
                </TabItem>
                <TabItem Header="Bestellhistory" FontSize="14">
                    <Grid Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="AUTO"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <ListView MouseDoubleClick="orders_MouseDoubleClick_1" Grid.Row="1" Name="orders" ItemsSource="{Binding Bestellungen}" Opacity="1" FontSize="14" ItemContainerStyle="{StaticResource CustomItemContainerStlye}">
                            <ListView.Background>
                                <RadialGradientBrush>
                                    <GradientStop Color="#FFF39393"/>
                                    <GradientStop Color="#FFA41B1B" Offset="1"/>
                                </RadialGradientBrush>
                            </ListView.Background>
                            <ListView.View>
                                <GridView ColumnHeaderContainerStyle="{StaticResource CustomHeaderStyle}">
                                    <GridViewColumn Width="140" Header="Name" DisplayMemberBinding="{Binding Kunde.Name}"/>
                                    <GridViewColumn Width="140" Header="Vorname" DisplayMemberBinding="{Binding Kunde.Vorname}"/>
                                    <GridViewColumn Width="140" Header="Produktanzahl" DisplayMemberBinding="{Binding Speisen.Count}"/>
                                    <GridViewColumn Width="60" Header="Summe" DisplayMemberBinding="{Binding Summe, StringFormat=C}"/>
                                    <GridViewColumn Width="140" Header="Datum" DisplayMemberBinding="{Binding Date}"/>
                                    <GridViewColumn Width="140" Header="Status" DisplayMemberBinding="{Binding Status}"/>
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </Grid>
                </TabItem>
            </TabControl>
        </Grid>
    </Grid>
</Window>
